package cn.edu.scau.cmi.wangzm.Finalexperiment;

import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
import sun.applet.Main;

public class Finalexperimentclient extends Application{
    private static Stage primaryStage;

    public Finalexperimentclient() {
		// TODO Auto-generated constructor stub
	}
	@Override
	public void start(Stage primaryStage) throws Exception {
		// TODO Auto-generated method stub
		this.primaryStage = primaryStage;
        this.primaryStage.setTitle("综合性实验");
        Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/wangzm/Finalexperiment/Finally.fxml"));
        Scene scene = new Scene(root);
        primaryStage.setScene(scene);
        primaryStage.show();
	}
    public static void main(String[] args) {
        launch(args);
    }
    public static void showFirst() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/singleton/Singleton.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验一：单例多例模式");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showSecond() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/simplefactory/Factory.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验二：简单工厂");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showThird() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/factory/Factory.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验二：工厂模式");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showForth() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/abstractfactory/AbstactFactory.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验二：抽象工厂");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showFifth() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/adapter/AdapterFXML.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验三：类/对象适配器");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showSixth() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/composite/safe/safe.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验四：安全型组合模式");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showSeventh() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/composite/consistent/consist.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验四：一致型组合模式");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void showEigth() {
        try {
            // 加载FXML文件，创建一个新的弹出对话框.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(Main.class.getResource("/cn/edu/scau/cmi/wangzm/comprehension/client/comprehension.fxml"));
            AnchorPane page = (AnchorPane) loader.load();
            // 创建对话框.
            Stage dialogStage = new Stage();
            dialogStage.setTitle("实验五：Hibernate模式");
            dialogStage.initModality(Modality.WINDOW_MODAL);
            dialogStage.initOwner(primaryStage);
            Scene scene = new Scene(page);
            dialogStage.setScene(scene);
            // 展示对话框直到用户关闭它
            dialogStage.showAndWait();
            //返回成功操作的信号
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
